<template>
  <div class="home">
      <p>
        账号： <input v-model="userInfo.userName" type="text">
      </p>
      <p>
        密码： <input v-model="userInfo.passWord" type="text">
      </p>
      <p>
        <button @click="login">登录</button>
      </p>
      <!-- <p>
        <button @click="del">删除</button>
      </p>
       <p>
        <button @click="edit">编辑</button>
      </p>
       <p>
        <button @click="init">获取数据</button>
      </p> -->
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'Home',
  data() {
    return {
      userInfo: {
        userName: "",
        passWord: ""
      }
    }
  },
  methods: {
    login() {
      axios.post('/login', this.userInfo).then(res => {
        console.log(res)
      })
    },
    del() {
      axios.delete('/del/12345').then(res => {
        console.log(res)
      })
    },
    edit() {
      axios.put('/edit/56789').then(res => {
        console.log(res)
      })
    },
    init() {
      axios.get('/list').then(res => {
        console.log(res)
      })
    }
  }
}
</script>
